/**
 * 
 */
package com.thinkgsp.jxc.model;

import java.io.Serializable;
import java.math.BigDecimal;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * 收款付款单明细
 * @author evan
 *
 */
public class RpBillDetail extends BaseModel implements Serializable {

	private static final long serialVersionUID = 270054297674112164L;

	private Long id;
	private Long rpBillId;
	private Long arpBillId;
	private BigDecimal settleAmount = BigDecimal.ZERO;
	private BigDecimal discount = BigDecimal.ZERO;
	private String remark;
	
	private RpContact contact;
	private RpArpBill arpBill;

	public RpContact getContact() {
		return contact;
	}

	public void setContact(RpContact contact) {
		this.contact = contact;
		if(contact != null) {
			arpBillId = contact.getArpBillId();
		}
	}

	public RpArpBill getArpBill() {
		return arpBill;
	}

	public void setArpBill(RpArpBill arpBill) {
		this.arpBill = arpBill;
		if(arpBill != null) {
			arpBillId = arpBill.getArpBillId();
		}
	}

	/**
	 * Id
	 * @return
	 */
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * 收款付款单Id
	 * @return
	 */
	public Long getRpBillId() {
		return rpBillId;
	}

	public void setRpBillId(Long rpBillId) {
		this.rpBillId = rpBillId;
	}

	/**
	 * 应收应付单Id
	 * @return
	 */
	public Long getArpBillId() {
		return arpBillId;
	}

	public void setArpBillId(Long arpBillId) {
		this.arpBillId = arpBillId;
	}

	/**
	 * 结算金额
	 * @return
	 */
	public BigDecimal getSettleAmount() {
		return settleAmount;
	}

	public void setSettleAmount(BigDecimal settleAmount) {
		this.settleAmount = settleAmount;
	}

	/**
	 * 折扣金额
	 * @return
	 */
	public BigDecimal getDiscount() {
		return discount;
	}

	public void setDiscount(BigDecimal discount) {
		this.discount = discount;
	}

	/**
	 * 备注
	 * @return
	 */
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#toString()
	 */
	@Override
	public String toString() {
		ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
		sb.append("id",this.id)
		  .append("rpBillId",this.rpBillId)
		  .append("arpBillId",this.arpBillId)
		  .append("settleAmount",this.settleAmount)
		  .append("discount",this.discount);
		
		return sb.toString();
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object o) {
		if(this == o) {
			return true;
		}
		if(!(o instanceof RpBill)) {
			return false;
		}
		final RpBillDetail detail = (RpBillDetail)o;
		if(id != null) {
			return id.equals(detail.getId());
		} else {
			return detail.getId() == null;
		}
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#hashCode()
	 */
	@Override
	public int hashCode() {
		return (this.id != null ? this.id.hashCode() : 0);
	}

}
